package servlet.rool;

import pojo.Admin;
import service.AdminService;
import service.impl.AdminServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 修改密码前返回修改对象的servlet
 */
@WebServlet(value = "/PasswordServlet")
public class PasswordServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String id=request.getParameter("id");
        AdminService as=new AdminServiceImpl();
        Admin admin=as.queryAdmin(Integer.parseInt(id));
        request.setAttribute("admin",admin);
        request.getRequestDispatcher("jsp/yjj/Password.jsp").forward(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }
}
